<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
 
  <t:datagrid name="applyList" checkbox="false" fitColumns="true" title="耗材出库申请" 
  	actionUrl="consumeMeterialStockOutController.do?applyDatagrid" idField="id" fit="true" queryMode="group">
   <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="申请状态"  field="applyState_value" hidden="true"    queryMode="single"  width="100"></t:dgCol>
   <t:dgCol title="申请日期"  field="createDate"  query="true"  formatter="yyyy-MM-dd"   queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="耗材名称"  field="meterial_name"   queryMode="single"  width="100"></t:dgCol>
   
   <t:dgCol title="申请数量"  field="outCount"   queryMode="single"  width="100"></t:dgCol> 
   <t:dgCol title="实验室"  field="lab_name"   queryMode="single"  width="120"></t:dgCol> 
   <t:dgCol title="申请状态"  field="applyState_name"    formatterjs="getstate" queryMode="single"  width="100"></t:dgCol>
   <t:dgCol title="操作" field="opt" width="140"></t:dgCol>
    <t:dgDelOpt title="删除" url="consumeMeterialStockOutController.do?doDel&id={id}" exp="applyState_value#eq#0,3"/>
   <t:dgFunOpt funname="submitApply(id)" title="提交" exp="applyState_value#eq#0,3"></t:dgFunOpt> 
   </t:datagrid>
 
 
 <script type="text/javascript">
 function getstate(t){
	 if(t=="初审通过" || t=="复审通过"){
		 return "审核通过";
	 }else {
		 return t;
	 }
 }
 
 function submitApply(id){
		$.dialog.confirm('确定要提交申请吗?', function(r) {
			   if (r) { 
					$.ajax({
						url : 'consumeMeterialStockOutController.do?submit&id='+id,
						type : 'post', 
						cache : false,
						success : function(data) {
							var d = $.parseJSON(data);
							if (d.success) {
								var msg = d.msg; 
								reloadTable(); 
							} 
							tip(d.msg); 
						}
					});
				}
			});
	}
 </script>
 
 <style>
 	 
 </style>